import mockRequest from '@/utils/mockRequest'

const state = {
  // 存储首页获取的数据
  homeData: {},
}
const mutations = {
  SAVEDATA(state, homeData){
    state.homeData = homeData;
  }
}
const actions = {
    //  发请求获取首页的模拟数据
    async  getData({commit}){
      let result = await mockRequest.get('/home/list')
      // console.log(result);
      if(result.code == 20000){
        commit("SAVEDATA", result.data)
      }
    }
}
const getters = {}


export default {
  state,
  mutations,
  actions,
  getters,


}
